home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / ARexx / 03 / 05.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-09-10  |  3.9 KB  |  215 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. PicAName = strip(line)
  22. line = readln(TempFile)
  23. Start = strip(line)
  24. line = readln(TempFile)
  25. End = strip(line)
  26. line = readln(TempFile)
  27. IAType = strip(line)
  28. line = readln(TempFile)
  29. Type2 = strip(line)
  30. line = readln(TempFile)
  31. ArgType2 = strip(line)
  32. line = readln(TempFile)
  33. AlphaName = strip(line)
  34. call close TempFile
  35.  
  36. Frames = (End - Start)+1
  37. j=0
  38. k=0
  39. TFrames = Frames
  40. TNum = 3
  41. if TFrames > 999 then TNum = 4
  42. if TFrames > 9999 then TNum = 5
  43. if Field = 1 then TFrames = Frames*2
  44. do i = Start to End
  45.     k = k+ 1
  46.     call open TempFile,"RAM:VFXNums",W
  47.     call writeln TempFile,right(k,5,'0')
  48.     call writeln TempFile,right(Frames,5,'0')
  49.     call close TempFile
  50.     f=0
  51.     Redraw Off
  52.     j = j+ 1
  53.     FieldSet = 0
  54.     call DoIt()
  55.     Redraw On
  56.     call SaveIt()
  57.         if Field = 1 then do
  58.             Redraw Off
  59.             j = j + 1
  60.             FieldSet = 1
  61.             call DoIt()
  62.             Redraw On
  63.             call SaveIt()
  64.             end 
  65.     end
  66.     Undo On
  67. exit
  68.  
  69.  
  70.  
  71. LoadA:
  72.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  73.         Undo On
  74.         exit
  75.         end
  76.     if IAType = 0 then do
  77.         LoadBuffer PicAName Force i
  78.         if Field = 1 then do
  79.             GetMain
  80.             parse var result Name Width Height Blah
  81.             if FieldSet = 0 then do
  82.                 Hook DeInterlace
  83.                 Scale Width Height
  84.                 end
  85.             if FieldSet = 1 then do
  86.                 Hook DeInterlace
  87.                 Swap
  88.                 Scale Width Height
  89.                 end
  90.             end
  91.         end
  92.     if IAType = 1 then do
  93.         LoadBuffer PicAName Force 1
  94.         end
  95.     if IAType = 2 then do
  96.         LoadBuffer PicAName Force
  97.         end
  98.     if IAType = 3 then do
  99.         LoadBuffer PicAName""right(i,TNum,'0') Force
  100.         end
  101. return
  102.  
  103.  
  104. SaveIt:
  105.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  106.         Undo On
  107.         exit
  108.         end
  109.     if SaveType = 0 then do
  110.         call Switcher(TOSW)
  111.         call Switcher(MDV1)
  112.  
  113.         Render Go
  114.         if Field = 1 then
  115.                 call RecordAdd(SaveName,1,6,Compression)
  116.         else
  117.                 call RecordAdd(SaveName,2,6,Compression)
  118.         if j = TFrames then
  119.             call MakeIcon(SaveName,(Frames-10))
  120.         end
  121.  
  122.     if SaveType = 1 then do
  123.         if Field = 1 then do
  124.             f= f + 1
  125.             if f = 1 then
  126.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  127.             if f = 2 then do
  128.                 GetMain
  129.                 parse var result Name Width Height Blah
  130.                 Scale Width Height/2
  131.                 Swap
  132.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  133.                 Scale Width Height/2
  134.                 Hook Interlace
  135.                 SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  136.                 f = 0
  137.                 end
  138.             end
  139.         else do
  140.             SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  141.             end    
  142.         end
  143.  
  144. return
  145.  
  146.  
  147. DoIt:
  148.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  149.         Undo On
  150.         exit
  151.         end
  152.     call LoadA()
  153.     GetMain
  154.     parse var result Name Width Height Blah
  155.     if j = 1 then do
  156.         Swap
  157.         LoadName = AlphaName
  158.         if ~exists(AlphaName) then LoadName = AlphaName""right(k,TNum,'0')
  159.         LoadBuffer LoadName Force
  160.         Scale Width Height
  161.         Buffer2Alpha
  162.         Swap
  163.         end
  164.     else do
  165.         Swap
  166.         LoadName = AlphaName
  167.         if ~exists(AlphaName) then do
  168.             LoadName = AlphaName""right(k,TNum,'0')
  169.             LoadBuffer LoadName Force
  170.             Scale Width Height
  171.             Buffer2Alpha
  172.             end
  173.         Swap
  174.         end
  175.     Buffer2Swap
  176.  
  177.     if Type2 = 0 then do
  178.         DrawMode ARGS ArgType2
  179.         DrawMode Lighten
  180.         FilledBox 0 0 Width Height
  181.         DrawMode Normal
  182.         end
  183.     if Type2 = 1 then do
  184.         ReliefMap 256 0
  185.         end
  186.     if Type2 = 2 then do
  187.         Solarize
  188.         end
  189.     if Type2 = 3 then do
  190.         Negative
  191.         end
  192.     if Type2 = 4 then do
  193.         Posterize 3
  194.         end
  195.     if Type2 = 5 then do
  196.         ColorToGrey 299 587 114
  197.         Grey2Color
  198.         Hook "Hooks/Sys/Antique"
  199.         end
  200.     if Type2 = 6 then do
  201.         Hook PolarBlur 50 0 0 Width%2 Height%2 Height 0 AntiAlias
  202.         end
  203.     if Type2 = 7 then do
  204.         DrawMode ARGS ArgType2
  205.         DrawMode Darken
  206.         FilledBox 0 0 Width Height
  207.         DrawMode Normal
  208.         end
  209.     Swap
  210.     Hook Composite MERGE 100 1 0 0 MatchMain AlphaFrisket SwapScale
  211.  
  212. return
  213.  
  214.  
  215.